# encoding: utf-8
# $Id$
import os

from google.appengine.api import memcache
from google.appengine.ext import db

import models

def update_count_per_footer_memcache():
	count_per_footer = models.Setting.all().filter('name =','count_per_footer').get().value
	memcache.set('count_per_footer',count_per_footer)

def update_site_name_memcache():
	site_name = models.Setting.all().filter('name','site_name').get().value
	memcache.set('site_name',site_name)

def get_count_per_footer_memcache():
	count_per_footer = memcache.get('count_per_footer')
	if count_per_footer is None:
		update_count_per_footer_memcache()
		count_per_footer = get_count_per_footer_memcache()
	return count_per_footer

def get_site_name_memcache():
	site_name = memcache.get('site_name')
	if site_name is None:
		update_site_name_memcache()
		site_name = get_site_name_memcache()
	return site_name
